package com.zuqiuzhandui.liveing.util;

import android.app.Activity;

import com.code19.library.L;
import com.zuqiuzhandui.liveing.net.MyUpdateWorker;

import org.lzh.framework.updatepluginlib.UpdateBuilder;
import org.lzh.framework.updatepluginlib.callback.UpdateDownloadCB;
import org.lzh.framework.updatepluginlib.creator.DefaultNeedInstallCreator;

import java.io.File;

/**
 * Created by yq on 2016-10-19.
 */

public class UpdataUtil {
    public static void CheckUpdate(Activity activity) {
        UpdateBuilder.create()
                .checkWorker(new MyUpdateWorker())
                .downloadCB(new UpdateDownloadCB() {
                    @Override
                    public void onUpdateStart() {
                        L.d("start download");
                    }

                    @Override
                    public void onUpdateComplete(File file) {
                        L.d("download end");
                    }

                    @Override
                    public void onUpdateProgress(long current, long total) {
                        L.d("downloading");
                    }

                    @Override
                    public void onUpdateError(int code, String errorMsg) {
                        L.d("error download");
                    }
                })
                .check(activity);
    }

}
